import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/mes-product/mro-dict/page',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: '/api/mes-product/mro-dict/detail',
    method: 'get',
    params: {
      id
    }
  });
};

export const remove = (ids) => {
  return request({
    url: '/api/mes-product/mro-dict/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/mes-product/mro-dict/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/mes-product/mro-dict/submit',
    method: 'post',
    data: row
  });
};

//列表查询不良配置
export const getMrodicts = (params) => {
  return request({
    url: '/api/mes-product/mro/dict/list',
    method: 'get',
    params: {
      ...params
    }
  });
};

//导出大类
export const exprot = ({ data }) => {
  return request({
    url: '/api/blade-resource/attach/export-template',
    method: 'POST',
    data: data,
    responseType: 'blob'
  });
};

// 莫名其妙的又提供一种奇葩的导出接口
export const getExprot = (data) => {
  return request({
    url: '/api/mes-admin/excelimportconfig/export/code',
    method: 'GET',
    params: {
      code: data
    },
    responseType: 'blob'
  });
};

export const checkCode = (data) => {
  return request({
    url: '/api/mes-product/mro-dict/check/before-submit',
    method: 'post',
    params: {
      ...data
    }
  });
};
